<?php
class TagService{

	public  $dbutil;
	function __construct($dbutil){
		$this->dbutil =  $dbutil;
	}
	/**
	 *
	 * 根据标签id获取文章ID
	 */
	public function getPostIdByTagId($tagId) {
		$sql = "SELECT post_id, t.tag_id, tag_name  FROM tags t , post_tag pt WHERE t.tag_id = pt.tag_id and t.tag_id = ".$tagId;
		$result = $this->dbutil->get_results ( $sql );
		return $result;
	}
	public function getTagByTagId($tagId){
        $sql = "SELECT *  FROM tags t  WHERE t.tag_id = ".$tagId;
        $result = $this->dbutil->get_results ( $sql );
        return $result[0];
    }
}